package nl.rainbowsheep.reisorg.rest.service.repository;

import java.util.List;
import nl.rainbowsheep.reisorg.rest.service.model.Accommodation;
import org.springframework.data.jpa.repository.JpaRepository;

public interface AccommodationRepository extends JpaRepository<Accommodation, Long> {

    /**
     * Finds Accommodation by all criteria
     *
     * @param accommodationTypeId
     * @param cityId
     * @param counryId
     * @param title
     * @param street
     * @param huisnumber
     * @param postalCode
     * @return
     */
    List<Accommodation> findByAccommodationTypeIdAndCityIdAndCountryIdAndTitleAndStreetAndHousenumberAndPostalCodeAndIsActive(
            Long accommodationTypeId, Long cityId, Long counryId, String title, String street, String huisnumber, String postalCode, boolean isActive);

    /**
     * Finds Accommodations that match title, city and country
     *
     * @param title
     * @param cityId
     * @param countryId
     * @return
     */
    List<Accommodation> findByTitleLikeAndCityIdAndCountryIdAndIsActiveAllIgnoreCase(String title, Long cityId, Long countryId, boolean isActive);

    /**
     * Finds Accommodations that match title and city
     *
     * @param title
     * @param cityId
     * @return
     */
    List<Accommodation> findByTitleLikeAndCityIdAndIsActiveAllIgnoreCase(String title, Long cityId, boolean isActive);

    /**
     * Finds Accommodations that match title and country
     *
     * @param title
     * @param countryId
     * @return
     */
    List<Accommodation> findByTitleLikeAndCountryIdAndIsActiveAllIgnoreCase(String title, Long countryId, boolean isActive);

    /**
     * Finds Accommodations that match title
     *
     * @param title
     * @return
     */
    List<Accommodation> findByTitleLikeAndIsActiveAllIgnoreCase(String title, boolean isActive);

    /**
     * Finds Accommodations that match city and country
     *
     * @param cityId
     * @param countryId
     * @return
     */
    List<Accommodation> findByCityIdAndCountryIdAndIsActive(Long cityId, Long countryId, boolean isActive);

    /**
     * Finds Accommodations that match city
     *
     * @param cityId
     * @return
     */
    List<Accommodation> findByCityIdAndIsActive(Long cityId, boolean isActive);

    /**
     * Finds Accommodations that match country
     *
     * @param countryId
     * @return
     */
    List<Accommodation> findByCountryIdAndIsActive(Long countryId, boolean isActive);

    Accommodation findByTitle(String title);
}
